package com.example.test.dao;

import com.example.test.dto.ScoreData;
import com.example.test.entities.Movies;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface MovieRepository extends JpaRepository<Movies,Long> {
    @Override
    public List<Movies> findAll();

    @Query(nativeQuery = true,value = "SELECT score AS label, COUNT(*) AS value FROM movies GROUP BY score")
    List<ScoreData> getMovieScore();
}
